package cn.bdqn.service.impl;

import cn.bdqn.entity.Student;
import cn.bdqn.mapper.StudentMapper;
import cn.bdqn.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhangpengxiang
 * @description TODO
 * @date 2024/7/16
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> findAll(Integer pageIndex, Integer pageSize,String name,String address){
        return studentMapper.findAll((pageIndex - 1) * pageSize,pageSize,name,address);
    }

    @Override
    public int countStudent(String name, String address) {
        return studentMapper.countStudent(name,address);
    }

    @Override
    public void addStudent(Student student) {
        studentMapper.addStudent(student);
    }

    @Override
    public void removeStudent(Integer id) {
        studentMapper.removeStudent(id);
    }

    @Override
    public Student getStudentById(Integer id) {
        return studentMapper.getStudentById(id);
    }

    @Override
    public void updateStudent(Student student) {
        studentMapper.updateStudent(student);
    }
}
